package com.example.zg3.notice

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import androidx.paging.cachedIn
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.example.base.mvvm.BaseActivity
import com.example.zg3.R
import com.example.zg3.databinding.ActivityNoticeBinding
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch

@AndroidEntryPoint
@Route(path = "/app/NoticeActivity")
class NoticeActivity : BaseActivity<ActivityNoticeBinding,NoticeViewModel>() {
    val noticeAdapter by lazy { NoticeAdapter() }
    override fun initData() {

    }

    override fun initView() {
        binding.rv.apply {
            adapter=noticeAdapter
            layoutManager=LinearLayoutManager(this@NoticeActivity)
        }
        lifecycleScope.launch {
            vm.getNotice().collect(){
                noticeAdapter.submitData(it)
            }
        }
    }
}